package com.twotwoshop.service.user.controller;


import com.twotwoshop.domin.common.dtos.ResponseResult;
import com.twotwoshop.domin.user.pojos.Follow;
import com.twotwoshop.service.user.service.IFollowService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * APP用户关注信息表 前端控制器
 * </p>
 *
 * @author 王帅
 * @since 2024-12-20
 */
@RestController
@RequestMapping("/user/follow")
@Slf4j
@RequiredArgsConstructor
public class FollowController {


    private final IFollowService followService;


    /**
     * 查询关注状态
     * @return
     */
    @GetMapping("/check/{userId}")  // 修改为正确的用户服务API路径
    ResponseResult followUserById(@PathVariable Integer userId){

        log.info("check......");

        return followService.checkUserById(userId);
    }




    /**
     * 关注卖家
     * @return
     */
    @PostMapping("/add")  // 修改为正确的用户服务API路径
    ResponseResult followUserById(@RequestBody Follow follow){

        log.info("followUserById......");

        return followService.followUserById(follow);
    }


    /**
     * 取关卖家
     * @return
     */
    @PostMapping("/cancel")  // 修改为正确的用户服务API路径
    ResponseResult cancelUserById(@RequestBody Follow follow){

        log.info("cancelUserById......");

        return followService.cancelUserById(follow);
    }


    /**
     * 获取关注列表
     * @return
     */
    @GetMapping("/list")  // 修改为正确的用户服务API路径
    ResponseResult listUserById(){

        log.info("listUserById......");

        return followService.listUserById();
    }
}
